import Vue from 'vue'
import VueRouter from 'vue-router'
import ElementView from "@/views/element/ElementView.vue";
import UserView from "@/views/manage/UserView.vue";
import LoginView from "@/views/login/LoginView.vue";
import DeviceView from "@/views/manage/DeviceView.vue";
import IndexView from "@/views/IndexView.vue";

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'home',
        redirect: '/login'
    },
    {
        path: '/login',
        name: 'login',
        component: LoginView
    },
    {
        path: '/index',
        name: 'index',
        component: IndexView,//嵌套子路由
        children: [
            {
                path: 'user',//不要加/
                name: 'user',
                component: UserView
            },
            {
                path: 'element',
                name: 'element',
                component: ElementView
            },
            {
                path: 'device',
                name: 'device',
                component: DeviceView
            }
        ]
    },


]

const router = new VueRouter({
    routes
})

export default router
